<?php
namespace Admin\Model;
use Think\Model;
class GoodsModel extends Model
{
    // 定义自动验证
    protected $_validate  = array(
        array('good_title', 'require', '标题必须填写'),
        array('good_bwrite','require','描述必须填写'),
        array('good_name','require','  商品名称必须填写'),
        array('good_keyword','require','  商品关键词必须填写'),
        array('stock','require','  商品数量必须填写'),
        array('stock','number','  商品数量必须是数字',['self::VALUE_VALIDATE']),
        array('depict','require','  商品描述必须填写'),
        array('good_price','require','  商品价格必须填写'),
        array('good_price','currency','  商品价格必须是数字',['self::VALUE_VALIDATE']),
    );
    // 定义自动完成
    protected $_auto = array(
        array('shelf_time', 'getDate', Model:: MODEL_INSERT, 'callback'),
    );

    // 获取当前日期时间
    public function getDate()
    {
        return date("Y-m-d H:i:s");
    }
}